#include "HashTable.h"



void test1()
{
	HashTable<int, int> h1;
	int a[] = { 1,4,24,34,7,44,17,37 };
	for (auto e : a)
	{
		h1.Insert(make_pair(e, e));
	}
	for (auto e : a)
	{
		auto ret = h1.Find(e);
		if (ret)
		{
			cout << e << ":E" << endl;
		}
		else
		{
			cout << e << ":D" << endl;
		}
	}
	cout << endl;

	h1.Erase(44);
	h1.Erase(17);

	for (auto e : a)
	{
		auto ret = h1.Find(e);
		if (ret)
		{
			cout << ret->_kv.first << ":E" << endl;
		}
		else
		{
			cout << e << ":D" << endl;
		}
	}
	cout << endl;
}

void test2()
{
	HashTable<string, string> h2;
	string s[] = { "sort","apple","one","two","car","dog"};
	for (auto e : s)
	{
		h2.Insert(make_pair(e, e));
	}
	for (auto e : s)
	{
		auto ret = h2.Find(e);
		if (ret)
		{
			cout << e << ":E" << endl;
		}
		else
		{
			cout << e << ":D" << endl;
		}
	}
	cout << endl;

	h2.Erase("apple");
	h2.Erase("dog");
	for (auto e : s)
	{
		auto ret = h2.Find(e);
		if (ret)
		{
			cout << ret->_kv.first << ":E" << endl;
		}
		else
		{
			cout << e << ":D" << endl;
		}
	}
	cout << endl;
}

void test3()
{

}
int main()
{
	test1();
	test2();
	//test3();

	return 0;
}